#ifndef SPI_CONFIG_H
#define SPI_CONFIG_H

#include "board_config.h"

/* init cs_pin 0 to avoid spi cs pin config,thus to config other gpio as cs pin */
#if defined(BOARD_CFG_SPIA)
#ifndef SPIA_CONFIG
#define SPIA_CONFIG                 \
    {                               \
        .name = "SPIA",             \
        .instance = &SpiaRegs,      \
        .intr_type = INT_SPIA_M,    \
        .sck_pin = 41,              \
        .mosi_pin = 16,             \
        .miso_pin = 17,             \
        .cs_pin = 0,                \
    }
#endif
#endif

#if defined(BOARD_SPIA_RX_USING_DMA)
#ifndef SPIA_RX_DMA_PARAM_CFG
#define SPIA_RX_DMA_PARAM_CFG                    \
{                                                \
    .srcAddr  =  0,                              \
    .destAddr =  0,                              \
    .blockSize = 7,                              \
    .srcWidth = DMA_TRANS_WIDTH_8,               \
    .destWidth = DMA_TRANS_WIDTH_8,              \
    .srcMsize = DMA_MSIZE_1,                     \
    .destMsize = DMA_MSIZE_1,                    \
    .srcHSInterface = DMA_TRIGGER_SPIA_M_RX,     \
    .destHSInterface = DMA_TRIGGER_MEM,          \
}
#endif

#ifndef SPIA_RX_DMA_CHANNEL_CFG
#define SPIA_RX_DMA_CHANNEL_CFG                  1
#endif

#endif

#if defined(BOARD_SPIA_TX_USING_DMA)
#ifndef SPIA_TX_DMA_PARAM_CFG
#define SPIA_TX_DMA_PARAM_CFG                    \
{                                                \
    .srcAddr  =  0,                              \
    .destAddr =  0,                              \
    .blockSize = 7,                              \
    .srcWidth = DMA_TRANS_WIDTH_8,               \
    .destWidth = DMA_TRANS_WIDTH_8,              \
    .srcMsize = DMA_MSIZE_1,                     \
    .destMsize = DMA_MSIZE_1,                    \
    .srcHSInterface = DMA_TRIGGER_MEM,           \
    .destHSInterface = DMA_TRIGGER_SPIA_M_TX,    \
}
#endif

#ifndef SPIA_TX_DMA_CHANNEL_CFG
#define SPIA_TX_DMA_CHANNEL_CFG                  2
#endif

#endif

#if defined(BOARD_CFG_SPIB)
#ifndef SPIB_CONFIG
#define SPIB_CONFIG                 \
    {                               \
        .name = "SPIB",             \
        .instance = &SpibRegs,      \
        .intr_type = INT_SPIB_M,    \
        .sck_pin = 14,              \
        .mosi_pin = 7,              \
        .miso_pin = 6,              \
        .cs_pin = 15,               \
    }
#endif
#endif


#endif
